package cc.smarnet.caihou.util;

import java.util.Calendar;

public class DateUtil {
    /**
     * 获取当前日期
     */
    public static String currentDate(){
        Calendar calendar = Calendar.getInstance();
        int mYear = calendar.get(Calendar.YEAR);
        int mMonth = calendar.get(Calendar.MONTH);
        int mDay = calendar.get(Calendar.DAY_OF_MONTH);

        String transMonth = String.format("%02d", mMonth + 1);// 如果月份小于10的话进行补0
        String transDay = String.format("%02d", mDay);// 如果日小于10的话进行补0

        return mYear + "-" + transMonth + "-" + transDay;
    }
}
